Export to PDF - Problem
Hello everyone,
Using FastReports.NET we are building Report which is exported in PDF.
Everything seems Ok and it works fine, unless we got (in several situation) in an unexpected error that There was an error opening the document. The file is damaged and could not be repaired.
We are mainly doing everything from code behind working on ASP.NET 2.0.
I have one TextObject which is bound to the Report Title.
Code:
TextObject repT = new TextObject();
myRep.Text = "Report Title 1";
myRep.FillColor = System.Drawing.Color.Silver;
myRep.Left = Units.Centimeters * (float)2;
myRep.Top = Units.Centimeters * (float)0.5;
myRep.Width = Units.Centimeters * (float)4;
myRep.Height = Units.Centimeters * (float)0.75;
System.Drawing.Font font = new System.Drawing.Font("Arial", 15.75F);
myRep.Font = font;
page1.ReportTitle.Objects.Add(myRep); //adding the object to page ReportTitle
So, if I leave it like this, it would work great. If I put text with length less then 7 characters, like myRep.Text = "Rep"; it will produce the above said Error.
One more thing to note: When the complete report is created, we use MemoryStream as Stream to write the report, like:
MemoryStream Strm = new MemoryStream();
report.Export(pdfexport,Strm);
Any suggestion?
Thank you,
Hajan
Using FastReports.NET we are building Report which is exported in PDF.
Everything seems Ok and it works fine, unless we got (in several situation) in an unexpected error that There was an error opening the document. The file is damaged and could not be repaired.
We are mainly doing everything from code behind working on ASP.NET 2.0.
I have one TextObject which is bound to the Report Title.
Code:
TextObject repT = new TextObject();
myRep.Text = "Report Title 1";
myRep.FillColor = System.Drawing.Color.Silver;
myRep.Left = Units.Centimeters * (float)2;
myRep.Top = Units.Centimeters * (float)0.5;
myRep.Width = Units.Centimeters * (float)4;
myRep.Height = Units.Centimeters * (float)0.75;
System.Drawing.Font font = new System.Drawing.Font("Arial", 15.75F);
myRep.Font = font;
page1.ReportTitle.Objects.Add(myRep); //adding the object to page ReportTitle
So, if I leave it like this, it would work great. If I put text with length less then 7 characters, like myRep.Text = "Rep"; it will produce the above said Error.
One more thing to note: When the complete report is created, we use MemoryStream as Stream to write the report, like:
MemoryStream Strm = new MemoryStream();
report.Export(pdfexport,Strm);
Any suggestion?
Thank you,
Hajan
Comments
I have been trying around to find a solution to this the whole day, and finally have found. It was related to the HttpContext of the page and the MemoryStream.
Everything else is OK regarding the FastReports.NET including converting to local fonts etc.
Thanks for reading me